const app = getApp()
var api = require('../../../utils/api.js')
var util = require('../../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    controllerPicture: "30rpx"
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var id = options.id;
    this.setData({
      id: id
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.returnOrderDetails();
  },


  //显示更多控制
  controllerPicture: function () {
    var text = this.data.controllerPicture;
    if (text == "30rpx") {
      text = "auto"
    } else {
      text = "30rpx"
    }
    this.setData({
      controllerPicture: text
    })
  },
  returnOrderDetails: function () {
    var that = this;
    var id = this.data.id;
    api.POST({
      params: { "id": id },
      url: app.globalData.base_url + 'aftersale/getInfo',
      success: function (res) {
        if (util.isEmpty(res.data.code)) {
          var productDetails = res.data.data;
          var total = (productDetails.number * productDetails.price).toFixed(2);
          that.setData({
            productDetails: productDetails,
            total: total,
          })
        }
      }
    })
  },
})